﻿using Company.IO.Interfaces;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SearchOption = System.IO.SearchOption;

namespace Company.System.IO.IntegrationTests
{
    public partial class DirectoryTest : TestBase<IDirectory>
    {
        private const string _SGetFilesMethodName = "GetFiles";

        [TestMethod]
        public void GetFiles_PathValid_Files()
        {
            //Arrange
            string path = SLocalPath;
            string[] expected = global::System.IO.Directory.GetFiles(path);

            //Act
            string[] actual = Directory.GetFiles(path);

            //Assert
            Assert.AreEqual(expected.Length, actual.Length);
        }

        [TestMethod]
        public void GetFiles_PathValidSearchPatternValid_Files()
        {
            //Arrange
            string path = SLocalPath;
            string searchPattern = string.Empty;
            string[] expected = global::System.IO.Directory.GetFiles(path, searchPattern);

            //Act
            string[] actual = Directory.GetFiles(path, searchPattern);

            //Assert
            Assert.AreEqual(expected.Length, actual.Length);
        }

        [TestMethod]
        public void GetFiles_PathValidSearchPatternValidSearchOptionAllDirectories_Files()
        {
            //Arrange
            string path = SLocalPath;
            string searchPattern = string.Empty;
            string[] expected = global::System.IO.Directory.GetFiles(path, searchPattern, SearchOption.AllDirectories);

            //Act
            string[] actual = Directory.GetFiles(path, searchPattern, Company.IO.Interfaces.SearchOption.AllDirectories);

            //Assert
            Assert.AreEqual(expected.Length, actual.Length);
        }

        [TestMethod]
        public void GetFiles_PathNull_ArgumentNullException()
        {
            PathNull_ArgumentNullException(_SGetFilesMethodName);
        }

        [TestMethod]
        public void GetFiles_PathEmpty_ArgumentException()
        {
            PathEmpty_ArgumentException(_SGetFilesMethodName);
        }
    }
}